{include file="pub/header" /}
	<div class="body"> 
		<div class="nav">
			添加自动回复
		</div>
		<div class="tap">
			<span class="active">添加自动回复</span>
		</div>
		<div class="from">
			<form action="" class="active" method="post" enctype="multipart/form-data">
				<div class="p">
					<label>
						<span class="span">公众号名字</span>
						<select name="wechat_id">
							{foreach name="wechat" item="value"}
								<option value="{$value.id}">{$value.wechat_name}</option>
							{/foreach}
						</select>
					</label>
				</div>
				<div class="p">
					<label>
						<span class="span">自动回复</span>
						<select name="event">
							{foreach name="wechat_event_config" item="value"}
								<option value="{$key}">{$value}</option>
							{/foreach}
						</select>
					</label>
				</div>
				<div class="p">
					<label>
						<span class="span">回复类型</span>
						<select name="autoreply">
							{foreach name="wechat_autoreply_config" item="value"}
								<option value="{$key}">{$value}</option>
							{/foreach}
						</select>
					</label>
				</div>
				<div id="info">
					


				</div>
				<div class="p">
					<label>
						<input type="submit" value="提交">
					</label>
				</div>
				
			</form>
			<script type="text/javascript">
				
				$("select[name='event']").change(function(event) {
					var event = parseInt($("select[name='event']").val());
					var autoreply = parseInt($("select[name='autoreply']").val());
					if (event != 0 && autoreply != 0) {
						changeInfo(event,autoreply);
					}
					
				});

				$("select[name='autoreply']").change(function(event) {
					var event = parseInt($("select[name='event']").val());
					var autoreply = parseInt($("select[name='autoreply']").val());
					if (event != 0 && autoreply != 0) {
						changeInfo(event,autoreply);
					}
				});

				function changeInfo(event,autoreply){
					if (event == 1) {
						if (autoreply == 1) {
							var html = '<div class="p"> <label> <span class="span">关键词</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">回复文字</span> <textarea name="description"></textarea> </label> </div>';
						}else if (autoreply == 2) {
							var html = '<div class="p"> <label> <span class="span">关键词</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">图片</span> <input type="file" name="img_url" /></label> </div>';
						}else if (autoreply == 3) {
							var html = '<div class="p"> <label> <span class="span">标题</span> <input type="text" name="title" /> </label> </div> <div class="p"> <label> <span class="span">关键词</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">描述</span> <input type="text" name="description" /> </label> </div> <div class="p"> <label> <span class="span">图片地址</span> <input type="text" name="img_url" /> </label> </div> <div class="p"> <label> <span class="span">文章地址</span> <input type="text" name="article_url" /> </label> </div>';
						}
					}else if (event == 2) {
						if (autoreply == 1) {
							var html = '<div class="p"> <label> <span class="span">回复文字</span> <textarea name="description"></textarea> </label> </div>';
						}else if (autoreply == 2) {
							var html = '<div class="p"> <label> <span class="span">图片</span> <input type="file" name="img_url" /></label> </div>';
						}else if (autoreply == 3) {
							var html = '<div class="p"> <label> <span class="span">关键词</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">描述</span> <input type="text" name="description" /> </label> </div> <div class="p"> <label> <span class="span">图片地址</span> <input type="text" name="img_url" /> </label> </div> <div class="p"> <label> <span class="span">文章地址</span> <input type="text" name="article_url" /> </label> </div>';
						}
					}else if (event == 3) {
						if (autoreply == 1) {
							var html = '<div class="p"> <label> <span class="span">回复文字</span> <textarea name="description"></textarea> </label> </div>';
						}else if (autoreply == 2) {
							var html = '<div class="p"> <label> <span class="span">图片</span> <input type="file" name="img_url" /></label> </div>';
						}else if (autoreply == 3) {
							var html = '<div class="p"> <label> <span class="span">关键词</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">描述</span> <input type="text" name="description" /> </label> </div> <div class="p"> <label> <span class="span">图片地址</span> <input type="text" name="img_url" /> </label> </div> <div class="p"> <label> <span class="span">文章地址</span> <input type="text" name="article_url" /> </label> </div>';
						}
					}else if (event == 4) {
						if (autoreply == 1) {
							var html = '<div class="p"> <label> <span class="span">菜单名称</span> <input type="text" name="title" /> </label> </div> <div class="p"> <label> <span class="span">菜单KEY值</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">回复文字</span> <textarea name="description"></textarea> </label> </div>';
						}else if (autoreply == 2) {
							var html = '<div class="p"> <label> <span class="span">菜单名称</span> <input type="text" name="title" /> </label> </div> <div class="p"> <label> <span class="span">菜单KEY值</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">图片</span> <input type="file" name="img_url" /></label> </div>';
						}else if (autoreply == 3) {
							var html = '<div class="p"> <label> <span class="span">标题</span> <input type="text" name="title" /> </label> </div> <div class="p"> <label> <span class="span">菜单KEY值</span> <input type="text" name="keywords" /> </label> </div> <div class="p"> <label> <span class="span">描述</span> <input type="text" name="description" /> </label> </div> <div class="p"> <label> <span class="span">图片地址</span> <input type="text" name="img_url" /> </label> </div> <div class="p"> <label> <span class="span">文章地址</span> <input type="text" name="article_url" /> </label> </div>';
						}
					}

					$("#info").html(html);
				}
			</script>
		</div>
	</div>
{include file="pub/footer" /}
